import re
pattern =r'([1-9]{1,3}(\.[0-9]{1,3}){3})'
string ='127.0.0.1 192.168.1.66'
match =re.findall(pattern,string)
for item in match:
    print(item[0])